package com.hzz.dto.dsync;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.hzz.framework.dto.BaseDto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * <p>基础数据  BEAN类。
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class EyBasePageResultDto<T> extends BaseDto {
    /**
     * 数据条数
     */
    Integer num;
    /**
     * 数据条数
     */
    List<T> dat;

    public boolean isHasNextPage(Integer pageNum, Integer pageSize) {
        boolean isHasNextPage = false;
        if (pageNum * pageSize < num) {
            isHasNextPage = true;
        }
        return isHasNextPage;
    }

    public int getPageCount(Integer pageSize) {
        return (num + pageSize - 1) / pageSize;
    }
}
